package com.gbco.intelligentpush.controller;

import com.gbco.intelligentpush.async.EventModel;
import com.gbco.intelligentpush.async.EventProducer;
import com.gbco.intelligentpush.async.EventType;
import com.gbco.intelligentpush.message.Common;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Slf4j
public class IntelligentController {

    @Autowired
    EventProducer eventProducer;

    @ResponseBody
    @GetMapping("test")
    public Common test(){

        EventModel eventModel = new EventModel();
        eventModel.setEventType(EventType.FINDCARD);
        eventProducer.fireEvent(eventModel);
        return new Common(200,"ok");
    }

    @GetMapping("new")
    public String get(){
        log.info("into new");
        return "my";
    }
}
